package com.tfjybj.itoo.exam.provider.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tfjybj.itoo.exam.entity.CollectionRecordEntity;
import com.tfjybj.itoo.exam.entity.ExaminationEntity;
import com.tfjybj.itoo.exam.model.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * CollectionRecordDao接口
 * collectionRecord表
 *
 * @author 王雪芬
 * @version 2.0.0
 * @since 2.0.0 2019-01-26 18:24:57
 */
@Repository("collectionRecordDao")
public interface CollectionRecordDao extends BaseMapper<CollectionRecordEntity> {
    /**
     * 查询还没有插入错题记录的错题
     *
     * @return
     * @author 李娜
     */
    List<PaperRecordModel> queryWrongRecord();

    /**
     * 查询状态为‘2’和‘3’的考试
     *
     * @return
     * @author 李娜
     */
    List<ExaminationEntity> queryExamByState();

    /**
     * 根据学生查询错题课程和小练
     *
     * @param studentId
     * @return
     * @author 李娜
     */
    List<ExamCourseModel> queryCourseExamination(@Param("status") Integer status, @Param("studentId") String studentId);

    /**
     * 根据小练和考生查询错题的章节和题型
     *
     * @param status
     * @param examinationId
     * @param examineeId
     * @return
     * @author 李娜
     */
    List<ChapterQuestionTypeModel> queryChapterType(@Param("status") Integer status, @Param("examinationId") String examinationId, @Param("examineeId") String examineeId);

    /**
     * 查询考试的错题信息
     *
     * @param examineeId
     * @param examinationId
     * @param questionTypeId
     * @param questionClassfiyId
     * @param status
     * @return
     */
    List<QuestionMainModel> queryWrongQuestion(@Param("examineeId") String examineeId, @Param("examinationId") String examinationId,
                                               @Param("questionTypeId") String questionTypeId, @Param("questionClassfiyId") String questionClassfiyId, @Param("status") Integer status);

    /**
     * 学生交卷时把该学生的错题存入错题记录表
     *
     * @param examineeId
     * @return
     */
    List<PaperRecordModel> queryWrongByExamineeId(@Param("examineeId") String examineeId);

    List<ChapterQuestionTypeModel> queryQuestionType(@Param("status") Integer status, @Param("examinationId") String examinationId, @Param("examineeId") String examineeId, @Param("chapterId") String chapterId);

    String queryScore(@Param("templateId") String templateId, @Param("questionTypeId") String questionTypeId);

    /**
     * 查询收藏夹是否已经存在该小题
     *
     * @param questionId 题干id
     * @return 查询收藏夹是否已经存在该小题
     * @author 刘梦娇
     * @since 2.0.0 2019年1月29日11:44:01
     */
    List<CollectionRecordModel> queryQuestionCollection(@Param("questionId") String questionId,
                                                        @Param("examineeId") String examineeId
    );

    boolean cancelCollection(@Param("examinationId") String examinationId, @Param("examineeId") String examineeId, @Param("questionId") String questionId);


    /**
     * 课程练习-根据课程id和题型id查询试题及选项
     *
     * @param courseId
     * @param questionTypeId
     * @return 是否查询成功
     * @author 贾建清
     * @since 2.0.0 2019-3-24 19:14:31
     */
    List<QuestionMainModel> queryQuestionOption(@Param("courseId") String courseId, @Param("questionTypeId") String questionTypeId);
}
